

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>parking status check</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="./css/mui.min.css">
		
		<style type="text/css">
			/*移除底部或顶部三角,需要在删除此代码*/
			.mui-popover .mui-popover-arrow:after {
			 	width: 0px; 
			 }
			 .table {
                border: 1px solid #cad9ea;
                color: #666;
                font-size: 18%;
            }

            .table th {
                background-repeat: repeat-x;
                height: 30px;
            }

            .table td,
            .table th {
                border: 1px solid #cad9ea;
                padding: 0 1em 0;
            }

            .table tr.alter {
                background-color: #f5fafe;
            }
            #pagezone{
            	color: #666;
            	font-size: 22%;
            }
		</style>
		
	</head>

	<?php
	include "sql.php";
	$pageSize = 5;
	if(is_array($_GET)&&count($_GET)==2){
		$parkingName = $start = $end = "";
		if($_SERVER["REQUEST_METHOD"] == "GET"){
			$parkingName = $_GET["parkingName"];
			$start = $_GET["start"];
			if($parkingName!=null && $parkingName!=""){
				$error = getErrorMsg($parkingName,$start,$pageSize);
				#$pass = getCarPassRecord($parkingName,$start,$end);
			}
			else echo null;
		}
	}	
?>

	<body>
		<!--页面主结构开始-->
		<div id="app" class="mui-views">
			<div class="mui-view">
				<div class="mui-navbar">
				</div>
				<div class="mui-pages">
				</div>
			</div>
		</div>
		<!--页面主结构结束-->
		<!--单页面开始-->
		<div id="setting" class="mui-page">
			<!--页面标题栏开始-->
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<h1 class="mui-center mui-title"><?php echo "$parkingName 车场状态监测"; ?></h1>
			</div>
			<!--页面标题栏结束-->
			<!--页面主内容区开始-->
			<div class="mui-page-content">
			<br><br>
					 <div> 
				        <table width="100%" class="table" id="tablevalue">
				            <tr><th width=20%>车场名</th><th width=27%>最后更新时间</th><th width=53%>详情</th></tr>
				                <tr>
				                	<td></td>
				                	<td></td>
				                	<td></td>
				                </tr>
				           		<?php
				           			if($error=="" || count($error)==0 || count($error[0])<2){ #no error log
				           				echo "<tr>\n";
				           				echo "<td>$parkingName</td>\n";
				           				echo "<td></td>\n";
				           				echo "<td>无错误信息</td>\n";
				           				echo "<tr>\n";
				           			}
				           			else{
				           				foreach ($error as $row) {
				           					echo "<tr>\n";
					           				echo "<td>$row[0]</td>\n";
					           				echo "<td>$row[4]</td>\n";
					           				echo "<td>$row[2]</td>\n";
					           				echo "<tr>\n";
				           				}
				           			}

				           		?>
				        </table>
				         <br>
				        <center>
				        	<?php
								$start2 = $start+$pageSize;
				        		$start1 = $start-$pageSize;
				        		if($start1<0) $start1=0;
				        		$size = getErrorMsgCount($parkingName);
				        		$page = ceil($size/$pageSize);
				        		if($page==0) $page = 1;
				        		if($start==0) $disableup = " disabled='disabled' ";
				        		else $disableup = "";
				        		if($size-$start2<=0)$disabledown = " disabled='disabled' ";
				        		else $disabledown = "";
				        		$curPage = floor($start/$pageSize)+1;
			
				        		echo "<a href='checkParkingStat.php' type='button' class='mui-btn mui-btn-primary'>首页</a>\n";
				        		echo "&nbsp&nbsp\n";
								echo "<a href='getErrorMsg.php?parkingName=$parkingName&start=$start1'><button  type='button' $disableup class='mui-btn mui-btn-warning'>上页</button></a>\n";
								echo "<a href='getErrorMsg.php?parkingName=$parkingName&start=$start2'><button type='button' $disabledown class='mui-btn mui-btn-success'>下页</button></a>\n";
								echo "&nbsp&nbsp\n";
								echo "<a href='getPassData.php?parkingName=$parkingName&start=0' type='button' class='mui-btn mui-btn-danger'>车辆记录</a>\n</br>";

								echo "<span id='pagezone'>当前第$curPage 页/ 共 $page 页  /共 $size 条 &nbsp</span>\n";	
				        	?>
				        </center>
				    </div>

				
			</div>
			<!--页面主内容区结束-->
		</div>
		

		
	</body>
	<script src="./js/mui.min.js "></script>
	
</html>
